package com.isunland.managesystem.ui;

import android.support.v4.app.Fragment;
import com.isunland.managesystem.entity.EmployeeLoanContent;

public class AddEmpoyeeLoanActivity extends SingleFragmentActivity {
  public static final String EXTRA_TYPE = "com.isunland.managesystem.ui.EXTRA_TYPE";

  // 判断是借款详情
  public static final int EXTRA_SHOWCONTENTTYPE = 0;
  // 判断是添加借款详情
  public static final int EXTRA_ADDCONTENTTYPE = 1;
  // 判断修改借款详情
  public static final int EXTRA_EDITCONTENTTYPE = 2;
  private android.support.v4.app.Fragment mFragment;

  @Override protected Fragment createFragment() {
    //根据type判断是添加还是现实详情
    int type = getIntent().getIntExtra(EXTRA_TYPE, 0);

    switch (type) {
      //详情界面
      case EXTRA_SHOWCONTENTTYPE:
        //接收传过来的content
        EmployeeLoanContent item = (EmployeeLoanContent) getIntent().getSerializableExtra(
            EmpoyeeLoanDetailFragment.EXTRA_EMPLOYEELOANContent);
        mFragment = EmpoyeeLoanDetailFragment.newInstance(item);
        break;
      //添加
      case EXTRA_ADDCONTENTTYPE:
        //接收传过来的content
        String code = getIntent().getStringExtra(AddEmpoyeeLoanDetailFragment.EXTRA_CODE);
        mFragment = AddEmpoyeeLoanDetailFragment.newInstance(code);
        break;
      //			//修改
      //		case EXTRA_EDITCONTENTTYPE:
      //			//接收传过来的content
      //			EmployeeLoanContent item2=(EmployeeLoanContent) getIntent().getSerializableExtra(EmpoyeeLoanDetailFragment.EXTRA_EMPLOYEELOANContent);
      //			mFragment= EmpoyeeLoanDetailFragment.newInstance(item2);
      //			break;
      default:
        break;
    }

    return mFragment;
  }
}
